extends layout

block content
  include includes/navbar.pug
  h1 图片分享
  .row
    .row.col-12.col-md-8
      if username
        .row.col-12
            .card.mt-1.mb-1.col-12
              .card-body
                form(action="/images/", method="post", enctype="multipart/form-data")
                  .form-group.row
                    label.col-12.col-md-2 浏览
                    input.col-12.col-md-10.form-control-file(type='file',name='imgfile')
                  .form-group.row
                    label.col-12.col-md-2 标题
                    input.col-12.col-md-10.form-control(type='text', name='title')
                  .form-group.row
                    label.col-12.col-md-2 描述
                    input.col-12.col-md-10.form-control(type='text', name='description')
                  .form-group.row
                    .col-12.offset-md-8.col-md-4
                      button.btn.btn-primary.btn-block(type='submit') 提交
      
      .row.col-12
        each image in images
          a.col-6.col-md-4(href=`/images/${image._id}`)
            .card
              img.card-img-top(src=`/uploads/${image.diskfilename}`, alt=image.title)
              .card-body
                h5.card-title= image.title
                p.card-text= image.description
      include includes/footer.pug
    .row.col-12.col-md-4
        include includes/stats.pug
        .list-group.col-12
          .list-group-item.active
            h6.list-group-item-heading Least comments
          each com in leastCom
            a.list-group-item
              h4.list-group-item-heading= com.nickname
              p.list-group-item-text= com.comment
        
              
